
***PSM
///产生随机数，设置种子值
set seed 20210819
gen ranorder=runiform()
sort ranorder

ssc install psmatch2,replace
psmatch2 treat cap loan lpr npl ldr roa lev, outcome( loan10) kernel ate ties common
pstest  cap lpr  lev ldr loan npl roa,both graph
psgraph
///采用核函数进行多维匹配指标进行倾向得分

psmatch2 treat cap loan lpr npl ldr lev roa, outcome( npl10) kernel ate ties common
pstest  cap lpr  lev ldr loan npl roa,both graph
psgraph

psmatch2 treat cap loan lpr npl ldr roa lev ,outcome( roa10) kernel ate ties common
pstest cap loan lpr npl ldr roa lev , both graph
psgraph
///此处没有进行稳健性检验


***DID
**1. 利用PSM的结果检验 延付高管薪酬对银行收益波动性的影响,验证假设1
**（1）检验2010-2013年的的平均处理效应 figure3
gen gd=t*treated
xtset i year

**VNIM
gen vnim=vnim*_wighted
xtreg vnimw gd t dumy2 dumy3 dumy4, fe 
   est store vnim_fe
xtreg vnimw gd t treated loang cap size lpr ldr roe gdpg lev dumy2 dumy3 dumy4, fe
   est store vnim_fecon
   
est table vnim_*,b(%7.4f)  star(0.1 0.05 0.01)
est table vnim_*,b(%7.4f) t(%7.4f) 

**VEBTP
gen vebtpw= vebtp* _weight
xtreg vebtpw gd t dumy2 dumy3 dumy4, fe
  est store vebtp_fe
xtreg vebtpw gd t treated cap size loang lpr ldr roe gdpg lev dumy2 dumy3 dumy4, fe
  est store vebtp_fecon
  
**zscore
gen zscorew=zscore* _weight
xtreg zscorew gd t dumy2 dumy3 dumy4, fe
 est store zscore_fe
xtreg zscorew gd t treated cap size loang lpr ldr roe gdpg lev dumy2 dumy3 dumy4,fe 
 est store zscore_fecon
 
 est table zscore_*,b(%7.4f)  star(0.1 0.05 0.01)
est table zscore_*,b(%7.4f) t(%7.4f)

**动态边际效应的检验  figure 5
gen gd2= dumy2* treated
gen gd3= dumy3* treated
gen gd4= dumy4* treated

**VNIM
xtreg vnimw gd2 gd3 gd4 dumy2 dumy3 dumy4 treated ,fe
 est store vnim_fe
xtreg vnimw gd2 gd3 gd4 dumy2 dumy3 dumy4 treated loang cap size lpr ldr roe gdpg lev, fe
 est store vnim_fecon
 
 est table vnim_*,b(%7.4f)  star(0.1 0.05 0.01)
est table vnim_*,b(%7.4f) t(%7.4f) 

**VEBTP
xtreg vebtpw gd2 gd3 gd4 dumy2 dumy3 dumy4 treated, fe 
 est store vebtp_fe
xtreg vebtpw gd2 gd3 gd4 dumy2 dumy3 dumy4 treated loang cap size lpr ldr roe gdpg lev, fe
 est store vebtp_fecon

 est table vebtp_*,b(%7.4f)  star(0.1 0.05 0.01)
est table vebtp_*,b(%7.4f) t(%7.4f)

**zscore
xtreg zscorew gd2 gd3 gd4 dumy2 dumy3 dumy4 treated, fe
 est store zscore_fe
xtreg zscorew gd2 gd3 gd4 dumy2 dumy3 dumy4 treated loang cap size lpr ldr roe gdpg lev, fe
 est store zscore_fecon

 est table vebtp_*,b(%7.4f)  star(0.1 0.05 0.01)
est table vebtp_*,b(%7.4f) t(%7.4f)


***检验盈余管理行为，验证假设2
**检测平均处理效应 figure4

gen llpw+=llp* _weight
gen t_ebtp=t*ebtp
gen tre_ebtp=treated*ebtp
gen gd_ebtp=gd*ebtp
gen gd_ebtp=t*treated*ebtp

xtreg llpw ebtp t treated tre_ebtp t_ebtp gd_ebtp gd dumy2 dumy3 dumy4, fe
 est store llp_fe
xtreg llpw ebtp t treated t_ebtp tre_ebtp gd gd_ebtp rp1 rp2 sign lco npl chnpl loan loang gdpg dumy2 dumy3 dumy4, fe 
 est store llp_fecon
 
 **动态边际效应的检验
gen dumy2_ebtp=dumy2*ebtp
gen dumy3_ebtp=dumy3*ebtp
gen dumy4_ebtp=dumy4*ebtp

gen gd2_ebtp=gd2*ebtp
gen gd3_ebtp=gd3*ebtp
gen gd4_ebtp=gd4*ebtp

xtreg llpw ebtp dumy2 dumy3 dumy4 dumy2_ebtp dumy3_ebtp dumy4_ebtp treated tre_ebtp gd2 gd3 gd4 gd2_ebtp gd3_ebtp gd4_ebtp, fe
 est store llp_fedt
xtreg llpw ebtp dumy2 dumy3 dumy4 dumy2_ebtp dumy3_ebtp dumy4_ebtp treated tre_ebtp gd2 gd3 gd4  gd2_ebtp gd3_ebtp gd4_ebtp rp1 rp2 sign lco npl chnpl loan loang gdpg,fe
 est store llp_fedtcon
 
est table llp_*,b(%7.4f)  star(0.1 0.05 0.01)
est table llp_*,b(%7.4f) t(%7.4f) 

